<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/css/pintuer.css">
    <link rel="stylesheet" href="/css/admin.css">
    <script src="/js/jquery.js"></script>
    <script src="/js/pintuer.js"></script>
    <script src="/js/vuejs-2.5.16.js"></script>
    <script src="/js/axios-0.18.0.js"></script>
</head>
<body>
<div class="panel admin-panel" id="adminInfo">
    <div class="panel-head"><strong><span class="icon-key"></span> 管理员账户信息</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="/question/save" enctype="multipart/form-data">
            <input type="hidden" name="id" v-model="admin.id">

            <div class="form-group">
                <div class="label">
                    <label>管理员：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="username" v-model="admin.username" placeholder="请输入用户名"
                           data-validate="required:请输入用户名"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>密码：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="password" v-model="admin.password" placeholder="请输入密码"
                           data-validate="required:请输入密码"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>手机号：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="phone" v-model="admin.phone" placeholder="请输入手机号"
                           data-validate="required:请输入手机号"/>
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 更新</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    import {Alert} from "./element-ui/types";

    const app = new Vue({
        el: '#adminInfo',
        data: {
            "telephone": '',
            "admin": {}
        },
        methods: {
            // 查询管理员账户信息
            findAdmin(telephone) {
                axios.get("/adminInfoByTelephone?telephone="+telephone).then(resp => {
                    this.admin = resp.data;
                    console.log(this.admin);
                })
            }
        },
        watch: {},
        created() {
            //获取地址栏中?telephone=xxx值
            this.telephone = location.search.split("?")[1].split("=")[1];
            console.log(this.telephone);
            this.findAdmin(this.telephone);

        }
    })

</script>
</body>
</html>